-- -*- mode: lua; -*-

-- This is a trivial example of a chain of random blocks. The output
-- of block N is connected to the seed of random block N+1.  The
-- system is constructed by hierarchically composing these blocks.

return bd.system
{
   -- include subsystems
   subsystems = {
      rnd1 = bd.load("rndchain1.usc")
   },

   imports = {
      "stdtypes", "random", "ptrig", "lfds_cyclic"
   },

   blocks = {
      { name='ptrig', type="ubx/ptrig" },
      { name="rnd0", type="ubx/random" },
   },

   configurations = {
      {	name="rnd0", config = { min_max_config={min=127, max=256} } },
      { name="ptrig", config = { period = {sec=1, usec=0 },
				 chain0={ { b="#rnd0", num_steps=1, measure=0 },
					       -- trigger the included subsystems trigger:
					       { b="#rnd1/trig", num_steps=1, measure=0 } } } },

   },

   connections = {
      { src="rnd0.rnd", tgt="rnd1/rnd1.seed" },
   },
}
